package com.chf.job.service.impl;

import com.chf.job.dao.FounderMapper;
import com.chf.job.pojo.Founder;
import com.chf.job.service.FounderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FounderServiceImpl implements FounderService {
    @Autowired
    private FounderMapper founderMapper;

    /**
     * 添加公司创始人
     * @param id
     * @param founder
     * @return
     */
    @Override
    public int addFounder(Integer id, Founder founder) {
        Founder newFounder = new Founder();
        newFounder.setCompanyId(Integer.toString(id));
        newFounder.setFounderName(founder.getFounderName());
        newFounder.setCurrentPosit(founder.getCurrentPosit());
        newFounder.setSinaUrl(founder.getSinaUrl());
        newFounder.setFounderSummary(founder.getFounderSummary());
        return founderMapper.insertSelective(newFounder);
    }

    /**
     * 根据公司id查询创始人团队
     * @param id
     * @return
     */
    @Override
    public List<Founder> getByCompanyId(Integer id) {
        return founderMapper.geByCompanyId(id);
    }
}
